import 'package:xbr_gaode_search/xbr_gaode_search.dart';

import 'base/amap_flutter_base.dart';

typedef QueryBack = Function(int? code, dynamic data);

class XbrGaodeAmap {
  // static const MethodChannel _channel = const MethodChannel('xbr_gaode_amap');

  ///自制自实例化工厂对象
  static XbrGaodeAmap? _init;
  XbrGaodeAmap();
  AMapApiKey? apikey;
  AMapPrivacyStatement? statement;
  ///自制自实例化工厂对象
  factory XbrGaodeAmap.instace() {
    if (_init == null) _init =  XbrGaodeAmap();
    return _init!;
  }

  ///初始化KAY
  static void initKey({required String androidKey,required String iosKey}){
    XbrGaodeAmap.instace().apikey = AMapApiKey(androidKey:androidKey,iosKey:iosKey);
    XbrAmapSearch.initKey(iosAppKey: iosKey,androidAppKey: androidKey);
  }

  ///更新协议
  static void updatePrivacy({required bool hasContains,required bool hasShow,required bool hasAgree}){
    XbrGaodeAmap.instace().statement = AMapPrivacyStatement(hasContains: hasContains,hasShow: hasShow, hasAgree: hasAgree);
    XbrAmapSearch.updatePrivacyShow(hasShow:hasShow,hasContains:hasContains);
    XbrAmapSearch.updatePrivacyAgree(hasAgree:hasAgree);
  }


}
